home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / recode.lha / recode-3.2.4 / maciibmp.c < prev    next >
C/C++ Source or Header  |  1992-08-19  |  3KB  |  66 lines

  1. /* Conversion of files between different charsets and usages.
  2.    Copyright (C) 1990 Free Software Foundation, Inc.
  3.    Francois Pinard <pinard@iro.umontreal.ca>, 1988.
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful, but
  11.    WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. #define STEP    applemac_ibmpc
  21. #include <stdio.h>
  22. #include "common.h"
  23.  
  24. static unsigned char translation_table[256] = 
  25.   {
  26.       0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, /* 11 */ 
  27.      12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, /* 23 */ 
  28.      24,  25,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35, /* 35 */ 
  29.      36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47, /* 47 */ 
  30.      48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59, /* 59 */ 
  31.      60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71, /* 71 */ 
  32.      72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83, /* 83 */ 
  33.      84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95, /* 95 */ 
  34.      96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, /* 107 */
  35.     108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, /* 119 */
  36.     120, 121, 122, 123, 124, 125, 126, 127, 142, 143, 128, 144, /* 131 */
  37.     165, 153, 154, 160, 133, 131, 132,   0, 134, 135, 130, 138, /* 143 */
  38.     136, 137, 161, 141, 140, 139, 164, 162, 149, 147, 148,   0, /* 155 */
  39.     163, 151, 150, 129,   0, 248, 155, 156,   0, 250,   0, 225, /* 167 */
  40.       0, 169, 170, 171, 172,   0, 146,   0, 236, 241, 243, 242, /* 179 */
  41.     157, 230, 235, 228, 184, 227, 186, 166, 167, 234, 145, 191, /* 191 */
  42.     168, 173, 194, 195, 159, 247, 198, 174, 175, 201, 202, 203, /* 203 */
  43.     204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 246, 215, /* 215 */
  44.     216, 217, 218, 219, 220, 221, 222, 223, 224,   0, 226,   0, /* 227 */
  45.       0, 229,   0, 231, 232, 233,   0,   0,   0, 237, 238, 239, /* 239 */
  46.     240,   0,   0,   0, 244, 245,   0,   0,   0, 249,   0, 251, /* 251 */
  47.     252, 253, 254, 255,
  48.   };
  49.  
  50. void
  51. STEP (FILE *input_file, FILE *output_file)
  52. {
  53.   int input_char;        /* current character */
  54.   int output_char;        /* translated character */
  55.  
  56.   while (input_char = getc (input_file), input_char != EOF)
  57.     if (input_char == '\n')
  58.       {
  59.     putc (0x0D, output_file);
  60.     putc (0x0A, output_file);
  61.       }
  62.     else
  63.       if (output_char = translation_table[input_char], output_char != '\0')
  64.     putc (output_char, output_file);
  65. }
  66.